using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WPCoco.Tasks
{
    public class RandomDelay : FiniteTime
    {
        public RandomDelay(float min, float max)
            : base(0)
        {
            this.min = Math.Min(min, max);
            this.max = Math.Max(min, max);
        }

        float min, max;

        Random rnd = new Random();

        public override void Initialize()
        {
            base.Initialize();
            Duration = min + (float)(rnd.NextDouble() * (max - min));
        }

        public override Task Clone()
        {
            return new RandomDelay(min, max);
        }

        public override Task Reverse()
        {
            return Clone();
        }
    }
}
